The base case is when a rock fragment is small enough. No more work needs to be done.
Here are the two parts to recursion:
And here is how this applies to triangle numbers:
The problem "Triangle(N)" is divided into two
problems: "add N to something"
and Triangle(N-1)".
Using the above, what is Triangle(3)?
(Fill in the boxes starting with the top row and work your way down.)
| Triangle( 3 ) = | + | Triangle( ) | |
| Triangle( 2 ) = | + | Triangle( ) | |
| Triangle( 1 ) = | |||
| Triangle( 2 ) = | + | ||
| Triangle( 3 ) = | + | ||
| Triangle( 3 ) = |